import Cookies from "js-cookie";
export const genCode = () => {
  const in10Minutes = new Date(new Date().getTime() + 30 * 60 * 1000); 
  const num = Math.floor(Math.random() * 10000); // 0 - 9999
  const code = num.toString().padStart(4, "0"); // 补零到4位
  Cookies.set('_c', code, { expires: in10Minutes });
  return code.toString();
};
